package com.example.nick.bodyapplication.aes;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.example.nick.bodyapplication.R;

import java.util.ArrayList;
import java.util.List;

public class AesActivity extends AppCompatActivity {

    class A {}
    interface B {}
    class Aa extends A {}
    class Aaa extends Aa {}

    class Ta<T extends Aa & B> {
        T t;
    }

    class Tb {
        public void ttt(Aa aa) {

        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aes);

        String enResutl = AESCBCUtil.encrypt("abc", AESCBCUtil.KEY, AESCBCUtil.IV);
        String deResult = AESCBCUtil.decrypt(enResutl, AESCBCUtil.KEY, AESCBCUtil.IV);
//        String enResutlGcm = AESCBCUtil.encryptGCM("abc", AESCBCUtil.KEY, AESCBCUtil.IV);
//        String deResultGcm = AESCBCUtil.decryptGCM(enResutl, AESCBCUtil.KEY, AESCBCUtil.IV);
        Log.i("aes", "enResutl:"+enResutl+", deResult:"+deResult);
//        Log.i("aes", "enResutlGcm:"+enResutlGcm+", deResultGcm:"+deResultGcm);
//        Ta<A> t0 = new Ta<>();
//        Ta<Aa> t1 = new Ta<>();
//        Ta<Aaa> t2 = new Ta<>();
//        // 「上界通配符」 <? extends Class>, 协变
//        List<Aaa> list_aaa = new ArrayList<>();
//        List<A> list_a = new ArrayList<>();
//        list_aaa.add(new Aaa());
//        Aaa aaa0 = list_aaa.get(0);
//        List<? extends Aa> list_aaa2 = list_aaa;
//        list_aaa2.add(new Aaa());
//        A aaa2 = list_aaa2.get(0);
//
//        List<? extends Aa> lista = new ArrayList<>();
//        lista.add(new A());
//        lista.add(new Aa());
//        lista.add(new Aaa());
//        lista.add(null);
//        A a = lista.get(0);
//        Aa aa = lista.get(0);
//        Aaa aaa = lista.get(0);
//
//        // 下界 <? super Class> , 逆变
//        List<? super Aa> listb = new ArrayList<>();
//        listb.add(new A());
//        listb.add(new Aa());
//        listb.add(new Aaa());
//        A b = listb.get(0);
//        Aa bb = listb.get(0);
//        Aaa bbb = listb.get(0);
    }
}